import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';

import api from './api/index';
import axios from './common/utils/axios';
import utils from './common/utils/utils';
import date from './common/utils/date';

import {
  Table,
  TableColumn,
  Pagination,
  Form,
  FormItem,
  Input,
  Radio,
  RadioGroup,
  RadioButton,
  Button,
  Select,
  Option,
  DatePicker,
  TimePicker,
  Row,
  Col,
  Switch,
  Checkbox,
  CheckboxGroup,
  Upload,
  Loading,
  MessageBox,
  Message,
  Icon,
  Dialog,
  Menu,
  Submenu,
  MenuItem,
  MenuItemGroup,
  Dropdown,
  DropdownMenu,
  DropdownItem,
  Avatar,
  Tree,
  Tabs,
  TabPane,
  Autocomplete
} from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import myForm from '@/components/common/form/index';
import myTable from '@/components/common/table/index';
import myEditor from '@/components/common/editor/index';
import myTree from '@/components/common/tree/index';
import formTable from '@/components/formTable';
import editForm from '@/components/common/editForm';
import upload from '@/components/common/upload'
import select_table from '@/components/common/select_table'

Vue.use(myForm);
Vue.use(myTable);
Vue.use(myEditor);
Vue.use(myTree);
Vue.component('FormTable',formTable)
Vue.component('editForm',editForm)
Vue.component('Upload',upload)
Vue.component('select-table',select_table)

// api列表
Vue.prototype.$api = api;
// 请求封装
Vue.prototype.$req = axios;
// 常用工具类封装
Vue.prototype.$utils = utils;
// 时间方法封装
Vue.prototype.$date = date;

// loading条
Vue.prototype.$loading = Loading.service;
// 弹窗组件
Vue.prototype.$msg = Message;
Vue.prototype.$msgBox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;

// 注册饿了么组件
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Pagination);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Input);
Vue.use(Radio);
Vue.use(RadioGroup);
Vue.use(RadioButton);
Vue.use(Button);
Vue.use(Select);
Vue.use(Option);
Vue.use(DatePicker);
Vue.use(TimePicker);
Vue.use(Upload);
Vue.use(Col);
Vue.use(Row);
Vue.use(Switch);
Vue.use(Checkbox);
Vue.use(CheckboxGroup);
Vue.use(Icon);
Vue.use(Dialog);
Vue.use(Menu);
Vue.use(Submenu);
Vue.use(MenuItem);
Vue.use(MenuItemGroup);
Vue.use(Dropdown);
Vue.use(DropdownMenu);
Vue.use(DropdownItem);
Vue.use(Avatar);
Vue.use(Tree);
Vue.use(Tabs);
Vue.use(TabPane);
Vue.use(Autocomplete);
Vue.use(Loading.directive);

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
